
// 判断是否为url
export const isUrl = (path: string): boolean => {
  try {
    new URL(path)
    return true
  } catch (_error) {
    return false
  }
}

const toString = Object.prototype.toString

// 判断类型
export const is = (val: unknown, type: string) => {
  return toString.call(val) === `[object ${type}]`
}

// 判断是否为字符串
export const isString = (val: unknown) => {
  return is(val, 'String')
}
